﻿using System;
using CustomerContactSystem.Core.Infrastructure.Domain;

namespace CustomerContactSystem.Core.Model {
    public class EnquiryFixYourStreetStatusUpdate : Entity {
        public virtual Enquiry Enquiry { get; set; }
        public virtual DateTime DateCreated { get; set; }
        public virtual int FixYourStreetId { get; set; }
        public virtual string Status { get; set; }
        public virtual bool StatusSent { get; set; }
        public virtual DateTime? DateSent { get; set; }

        protected override void Validate() {
            if (Enquiry == null) {
                AddBrokenRule(new BusinessRule("Enquiry", "Enquiry is required!"));
            }

            if (DateCreated == DateTime.MinValue) {
                AddBrokenRule(new BusinessRule("DateCreated", "Date created is required!"));
            }

            if (FixYourStreetId == 0) {
                AddBrokenRule(new BusinessRule("FixYourSreetId", "Fix Your Street Id is required!"));
            }

            if (string.IsNullOrEmpty(Status)) {
                AddBrokenRule(new BusinessRule("Status", "Status is required!"));
            }
        }
    }
}